﻿// See https://aka.ms/new-console-template for more information

using BootstrapBlazorApp.Server.LLMs.chain;
using BootstrapBlazorApp.Server.LLMs.function;
using BootstrapBlazorApp.Server.LLMs.model.Kimi;
using BootstrapBlazorApp.Server.LLMs.model.TongYi;
using BootstrapBlazorApp.Server.LLMs.parser;
using System.ComponentModel;

class User
{
    [Description("用户名")]
    public string Name { get; set; } = "张三";
}

internal class Program
{
    public static async Task Main(string[] args)
    {
        // TongYiConfig config = new TongYiConfig("sk-02112a6101224a7790d1efba39cbb3d3");
        // var chatTongYi = new ChatTongYi(config);
        KimiConfig config = new KimiConfig("sk-FFBqRHmUD5EqIDJWfwH0xrfegU38rsGuwmN1JD6Z2lxFZ1IU");
        var kimi = new ChatKimi(config);
        kimi.BindTools(typeof(Weather));
        var chain = SequenceChain.Init(kimi)
            .Pipeline(new StringOutPutParser());
        var  context = await chain.InvokeAsync("杭州的天气怎么样");
        Console.WriteLine(context.OutPutContent);
    }
}

class Weather
{
    [FunctionDescription("当你想查询指定城市的天气时非常有用。")]
    public string GetWeather([FunctionArg("城市或县区，比如北京市、杭州市、余杭区等。")]string location)
    {
        return "晴天";
    }

    [FunctionDescription("当你想知道现在的时间时非常有用。")]
    public string GetTime()
    {
        return "2024-11-24";
    }
}